package com.airforce.mappers;

import com.airforce.model.award;
import org.apache.ibatis.jdbc.SQL;

public class awardSqlProvider {

    public String insertSelective(award record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("award");
        
        if (record.getId() != null) {
            sql.VALUES("id", "#{id,jdbcType=INTEGER}");
        }
        
        if (record.getName() != null) {
            sql.VALUES("name", "#{name,jdbcType=VARCHAR}");
        }
        
        if (record.getPrice() != null) {
            sql.VALUES("price", "#{price,jdbcType=DECIMAL}");
        }
        
        if (record.getType() != null) {
            sql.VALUES("type", "#{type,jdbcType=INTEGER}");
        }
        
        if (record.getRule() != null) {
            sql.VALUES("rule", "#{rule,jdbcType=VARCHAR}");
        }
        
        if (record.getPhase() != null) {
            sql.VALUES("phase", "#{phase,jdbcType=INTEGER}");
        }
        
        if (record.getHightflag() != null) {
            sql.VALUES("hightFlag", "#{hightflag,jdbcType=TINYINT}");
        }
        
        if (record.getCreatetime() != null) {
            sql.VALUES("createtime", "#{createtime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdatetime() != null) {
            sql.VALUES("updatetime", "#{updatetime,jdbcType=TIMESTAMP}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(award record) {
        SQL sql = new SQL();
        sql.UPDATE("award");
        
        if (record.getName() != null) {
            sql.SET("name = #{name,jdbcType=VARCHAR}");
        }
        
        if (record.getPrice() != null) {
            sql.SET("price = #{price,jdbcType=DECIMAL}");
        }
        
        if (record.getType() != null) {
            sql.SET("type = #{type,jdbcType=INTEGER}");
        }
        
        if (record.getRule() != null) {
            sql.SET("rule = #{rule,jdbcType=VARCHAR}");
        }
        
        if (record.getPhase() != null) {
            sql.SET("phase = #{phase,jdbcType=INTEGER}");
        }
        
        if (record.getHightflag() != null) {
            sql.SET("hightFlag = #{hightflag,jdbcType=TINYINT}");
        }
        
        if (record.getCreatetime() != null) {
            sql.SET("createtime = #{createtime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdatetime() != null) {
            sql.SET("updatetime = #{updatetime,jdbcType=TIMESTAMP}");
        }
        
        sql.WHERE("id = #{id,jdbcType=INTEGER}");
        
        return sql.toString();
    }
}